package com.structure.compositePattern.service.logic.iml;

import com.structure.compositePattern.model.vo.TreeNodeLink;
import com.structure.compositePattern.service.logic.BaseLogic;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Map;

/**
 * 性别节点
 *
 * @author xiaobing
 * @version 1.0
 * @date 2021/9/9 2:14 下午
 */
public class UserGenderFilter extends BaseLogic {
    @Override
    public Long filter(String matterValue, List<TreeNodeLink> treeNodeLinks) {
        for (TreeNodeLink treeNodeLink : treeNodeLinks) {
            if (StringUtils.isNotBlank(matterValue) && matterValue.equals(treeNodeLink.getRuleLimitValue())) {
                return treeNodeLink.getNodeIdTo();
            }
        }
        return 0L;
    }

    @Override
    public String matterValue(Long treeId, String userId, Map<String, String> decisionMatter) {
        return decisionMatter.get("gender");
    }


}
